﻿@page
@model IndexModel

@{
    ViewData["Title"] = "Home page";
}

<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

@* This is the namespace where the Blazor components reside, shortens the type parameter of the component tag helper *@
@using BlazorInRazorPages.Components


@* add Blazor components, read the comments about the issues with Parameters*@

<component type="typeof(Counter)" render-mode="ServerPrerendered" />

@*
    There seems to be an issue in the framework with passing parameters to Blazor components.
    Adding the following will throw an error in the console similar to
    Error: The list of component records is not valid.
    Which seems related to the following issue that was supposedly fixed in .NET Core 3.1 Preview 2
    but it seems that it still manifests
        https://github.com/aspnet/AspNetCore/issues/14966
        https://github.com/aspnet/AspNetCore/issues/14474
    So, it seems, that components should handle their own data and receiving parameters may be impossible
*@

@*<component type="typeof(Counter)" render-mode="ServerPrerendered" param-Customers="@Model.BlazorGridData.Take(4)" />*@


@*If the basic Blazor components start working properly with parameters, the Telerik ones should too*@

@*

     <component type="typeof(MyGrid)" render-mode="ServerPrerendered" param-Customers="@Model.BlazorGridData" />

      For the sake of the demo, we will add a second grid with similar data here

    <component type="typeof(MyGrid)" render-mode="ServerPrerendered" param-Customers="@Model.BlazorGridData.Take(5)" />

*@

<component type="typeof(MyWindow)" render-mode="ServerPrerendered" />

<component type="typeof(MyDropDown)" render-mode="ServerPrerendered" />

<component type="typeof(MyGrid)" render-mode="ServerPrerendered" />